<template>
    <!-- 标题 -->
    <div class="title">
        数据看板
        <el-divider />
    </div>
    <el-row :gutter="0">
      <el-col :span="6">
        <div class="statistic-card">
          <el-statistic value-style="color: #3498db;" :value="'￥'+dashboard.todayConsumeAmount">
            <template #title>
              <div style="display: inline-flex; align-items: center">
                今日客户消费金额
                <el-tooltip
                  effect="dark"
                  content="今日客户消费金额"
                  placement="top"
                >
                  <el-icon style="margin-left: 4px" :size="12">
                    <Warning />
                  </el-icon>
                </el-tooltip>
              </div>
            </template>
          </el-statistic>
          <div class="statistic-footer">
            <div class="footer-item">
              <span>消费客户数:</span>
              <span class="green">
                {{ dashboard.todayConsumeUserNum }}
              </span>
            </div>
          </div>
        </div>
      </el-col>
      <el-col :span="6">
        <div class="statistic-card">
          <el-statistic value-style="color: #3498db;" :value="'￥'+dashboard.todayCustomerRecharge+'/'+dashboard.todayPartnerRecharge">
            <template #title>
              <div style="display: inline-flex; align-items: center">
                今日客户/二代充值金额
                <el-tooltip
                  effect="dark"
                  content="今日客户/二代充值金额"
                  placement="top"
                >
                  <el-icon style="margin-left: 4px" :size="12">
                    <Warning />
                  </el-icon>
                </el-tooltip>
              </div>
            </template>
          </el-statistic>
          <div class="statistic-footer">
            <div class="footer-item">
              <span>充值人数:</span>
              <span class="red">
                {{ dashboard.todayCustomerRechargeNum +'/'+ dashboard.todayPartnerRechargeNum }}
              </span>
            </div>
            <div class="footer-item">
              <span>收益:</span>
              <span class="red">
                {{ dashboard.todayIncome }}
              </span>
            </div>
          </div>
        </div>
      </el-col>
      <el-col :span="6">
        <div class="statistic-card">
          <el-statistic :value="dashboard.todayInviteCustomerNum" value-style="color: #3498db;" title="今日邀请客户数">
            <template #title>
              <div style="display: inline-flex; align-items: center">
                今日邀请客户数
              </div>
            </template>
          </el-statistic>
          <div class="statistic-footer">
            <div class="footer-item">
              <span>未实名:</span>
              <span class="green">
                {{ dashboard.todayInviteCustomerNotRealNum }}
              </span>
            </div>
            <div class="footer-item">
              <span>已实名:</span>
              <span class="green">
                {{ dashboard.todayInviteCustomerRealNum }}
              </span>
            </div>
          </div>
        </div>
      </el-col>
      <el-col :span="6">
        <div class="statistic-card">
          <el-statistic :value="dashboard.todayInvitePartnerNum" value-style="color: #3498db;" title="今日邀请客户数">
            <template #title>
              <div style="display: inline-flex; align-items: center">
                今日二代邀请数
              </div>
            </template>
          </el-statistic>
          <div class="statistic-footer">
            <div class="footer-item">
              <span>未实名:</span>
              <span class="green">
                {{ dashboard.todayInvitePartnerNotRealNum }}
              </span>
            </div>
            <div class="footer-item">
              <span>已实名:</span>
              <span class="green">
                {{ dashboard.todayInvitePartnerRealNum }}
              </span>
            </div>
          </div>
        </div>
      </el-col>
    </el-row>
</template>
  
<script lang="ts" setup>

import {
    ArrowRight,
    CaretBottom,
    CaretTop,
    Warning,
} from '@element-plus/icons-vue'
import { getDataBoard } from '@/api/index'
import { ref, onMounted } from 'vue'


const dashboard = ref(
  {
    "todayConsumeAmount": "0.0",
    "todayConsumeUserNum": 0,
    "todayPartnerRecharge": "0",
    "todayCustomerRecharge": "0",
    "todayPartnerRechargeNum": 0,
    "todayCustomerRechargeNum": 0,
    "todayIncome": "0",
    "todayInvitePartnerNum": 0,
    "todayInvitePartnerRealNum": 0,
    "todayInvitePartnerNotRealNum": 0,
    "todayInviteCustomerNum": 0,
    "todayInviteCustomerRealNum": 0,
    "todayInviteCustomerNotRealNum": 0
  }
)
onMounted(() => {
  getDataBoard({}).then(res => {
    console.log(res.data)
    dashboard.value = res.data
  })
})




</script>
  
<style scoped>
:global(h2#card-usage ~ .example .example-showcase) {
    background-color: var(--el-fill-color) !important;
}

.title{
    margin-top: 20px;
    margin-left: 20px;
    font-size: 18px;
}

.el-statistic {
    --el-statistic-content-font-size: 28px; 
}

.statistic-card {
    height: 80%;
    margin: 10px;
    padding: 20px;
    border-radius: 4px;
    background-color: #efe5e5;
}

.statistic-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--el-text-color-regular);
    margin-top: 16px;
}

.statistic-footer .footer-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.statistic-footer .footer-item span:last-child {
    display: inline-flex;
    align-items: center;
    margin-left: 4px;
}

.green {
    color: var(--el-color-success);
}
.red {
    color: var(--el-color-error);
}
</style>
  